package com.minimalist.common.entity.tc.entity.vo.order;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.util.Objects;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 11987
 */
@Schema(description = "停车_订单实体")
public class TcOrderVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "订单ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "orderId", description = "订单ID", type = "string")
    private Long orderId;

    @NotNull(message = "订单号不能为空", groups = {Add.class, Update.class})
    @Schema(name = "orderNumber", description = "订单号", type = "string")
    private String orderNumber;

    @NotNull(message = "泊位号不能为空", groups = {Add.class, Update.class})
    @Schema(name = "berthNumber", description = "泊位号", type = "string")
    private String berthNumber;

    @NotNull(message = "收费点不能为空", groups = {Add.class, Update.class})
    @Schema(name = "pointCharge", description = "收费点", type = "string")
    private String pointCharge;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "enterDate", description = "驶入时间", type = "string")
    private Date enterDate;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "exitDate", description = "驶离时间", type = "string")
    private Date exitDate;

    @Schema(name = "stayDate", description = "停留时长", type = "string")
    private String stayDate;

    @NotNull(message = "车牌号不能为空", groups = {Add.class, Update.class})
    @Schema(name = "plateNumber", description = "车牌号", type = "string")
    private String plateNumber;

    @Schema(name = "pictureUrl", description = "图片链接", type = "string")
    private String pictureUrl;

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getBerthNumber() {
        return berthNumber;
    }

    public void setBerthNumber(String berthNumber) {
        this.berthNumber = berthNumber;
    }

    public String getPointCharge() {
        return pointCharge;
    }

    public void setPointCharge(String pointCharge) {
        this.pointCharge = pointCharge;
    }

    public Date getEnterDate() {
        return enterDate;
    }

    public void setEnterDate(Date enterDate) {
        this.enterDate = enterDate;
    }

    public Date getExitDate() {
        return exitDate;
    }

    public void setExitDate(Date exitDate) {
        this.exitDate = exitDate;
    }

    public String getStayDate() {
        return stayDate;
    }

    public void setStayDate(String stayDate) {
        this.stayDate = stayDate;
    }

    public String getPlateNumber() {
        return plateNumber;
    }

    public void setPlateNumber(String plateNumber) {
        this.plateNumber = plateNumber;
    }

    public String getPictureUrl() {
        return pictureUrl;
    }

    public void setPictureUrl(String pictureUrl) {
        this.pictureUrl = pictureUrl;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TcOrderVO tcOrderVO = (TcOrderVO) o;
        return Objects.equals(orderId, tcOrderVO.orderId) &&
               Objects.equals(orderNumber, tcOrderVO.orderNumber) &&
               Objects.equals(berthNumber, tcOrderVO.berthNumber) &&
               Objects.equals(pointCharge, tcOrderVO.pointCharge) &&
               Objects.equals(enterDate, tcOrderVO.enterDate) &&
               Objects.equals(exitDate, tcOrderVO.exitDate) &&
               Objects.equals(stayDate, tcOrderVO.stayDate) &&
               Objects.equals(plateNumber, tcOrderVO.plateNumber) &&
               Objects.equals(pictureUrl, tcOrderVO.pictureUrl);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderId, orderNumber, berthNumber, pointCharge, enterDate, exitDate, stayDate, plateNumber, pictureUrl);
    }

    @Override
    public String toString() {
        return "TcOrderVO{" +
               "orderId=" + orderId +
               ", orderNumber='" + orderNumber + '\'' +
               ", berthNumber='" + berthNumber + '\'' +
               ", pointCharge='" + pointCharge + '\'' +
               ", enterDate=" + enterDate +
               ", exitDate=" + exitDate +
               ", stayDate='" + stayDate + '\'' +
               ", plateNumber='" + plateNumber + '\'' +
               ", pictureUrl='" + pictureUrl + '\'' +
               '}';
    }
}
